using DG.Tweening;
using UnityEngine;

public class HomeHole : MonoBehaviour
{
	public Transform skinContainer;

	private Skin _currentSkin;

	private SkinParameters _currentSkinParameters;

	private Tween _displayTween;

	public void SetSkin(SkinParameters skin)
	{
		if (_currentSkin != null)
		{
			UnityEngine.Object.Destroy(_currentSkin.gameObject);
		}
		_currentSkinParameters = skin;
		_currentSkin = UnityEngine.Object.Instantiate(skin.skinPrefab, skinContainer);
		_currentSkin.SetSize(0.15f);
		_currentSkin.transform.localRotation = Quaternion.Euler(skin.startRotation);
	}

	public void DisplayWithAnimation(bool state)
	{
		if (_displayTween != null)
		{
			_displayTween.Kill();
		}
		if (state)
		{
			base.transform.localScale = Vector3.zero;
			base.transform.DOScale(1f, 0.2f);
		}
		else
		{
			base.transform.localScale = Vector3.one;
			base.transform.DOScale(new Vector3(0f, 1f, 0f), 0.2f);
		}
	}

	public void PlaySkinFX()
	{
		if ((bool)_currentSkin)
		{
			_currentSkin.PlayFX();
		}
	}

	public void StopSkinFX()
	{
		if ((bool)_currentSkin)
		{
			_currentSkin.StopFX();
		}
	}
}
